{block name="content"}
{include file='control/plan/formstyle'}
<form action="{:request()->url()}" autocomplete="off" class="layui-form layui-card" data-auto="true" method="post">
    <div class="layui-card-body" style="padding-bottom: 5%;padding-top: 5%;">
        <div class="layui-form-item relative block layui-col-xs6" style="margin-left: 10%">
            <span class="color-green font-w7">下级审批权限</span>
            <span class="color-desc margin-left-5"></span>
            <select class="layui-select" required name="plan_status" lay-filter="plan_status">
                {volist name='auth_list' id='ps'}
                {if 3 eq $ps.sort}
                <option value="{$ps.sort}" selected>- {$ps.title} -</option>
                {else /}
                <option value="{$ps.sort}">- {$ps.title} -</option>
                {/if}
                {/volist}
            </select>
        </div>
        <div class="layui-form-item relative block layui-col-xs6" style="margin-left: 10%">
            <span class="color-green font-w7">下级审批人</span>
            <span class="color-desc margin-left-5"></span>
            <select class="layui-select" name="below_admin_id" lay-search id="two_cate">
                <option value="">- 请选择 -</option>
                {volist name='list' id='ls'}
                <option value="{$ls.id}">- {$ls.username} -</option>
                {/volist}
            </select>
        </div>
<!--        <div class="layui-form-item relative block layui-col-xs6" style="margin-left: 10%">-->
<!--            <span class="color-green font-w7">审核</span>-->
<!--            <span class="color-desc margin-left-5">Kuangji Lingdao</span>-->
<!--            <div>-->
<!--                <label class="think-radio layui-unselect">-->
<!--                    <input type="radio" checked name="status" value="1" lay-ignore> 通过-->
<!--                </label>-->
<!--                <label class="think-radio layui-unselect">-->
<!--                    <input type="radio" name="status" value="-1" lay-ignore> 拒绝-->
<!--                </label>-->
<!--            </div>-->
<!--        </div>-->
        <input type="hidden" name="id" value="{$_GET['id']}">
        <label class="layui-form-item block" style="margin-left: 10%">
            <span class="font-w7 color-green">备注</span>
            <textarea class="layui-textarea" name="remarks" placeholder="请输入备注信息">{$vo.remarks|default=''|raw}</textarea>
        </label>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存</button>
        <button class="layui-btn layui-btn-danger"type='button' data-close>取消</button>
    </div>
</form>

<script>

    form.on('select(plan_status)', function(data){
        console.log(data)
        //data.value 得到被选中的值
        $.ajax({
            url:"{:url('getParentInfo')}",
            data:{
                id:data.value
            },
            success:function (res) {
                res = JSON.parse(res)
                $("#two_cate").empty();
                if(res.length > 0){
                    var json_sr = ''
                    for (var i=0;i<res.length;i++){
                        json_sr += '<option value='+res[i].id+'>- '+res[i].username +' -</option>'
                    }
                    console.log(json_sr)
                    $('#two_cate').html(json_sr)
                }
                layui.form.render("select");
            }
        })
    });

    form.render()
</script>

{/block}